home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / pascal / dblk2.zip / DBLKTST1.PAS < prev    next >
Pascal/Delphi Source File  |  1989-09-30  |  1KB  |  46 lines

  1. program dblktest;
  2. { Uses more of the functions in dblook to select particular records and
  3.   fields to display.
  4. }
  5. uses
  6.    crt,dblook;
  7.  
  8. var
  9.    i         :integer;
  10.    ch        :char;
  11.  
  12. begin   { main }
  13.    clrscr;
  14.    writeln('Utility to read Dbase III+ .DBF files.         ',version_no);
  15.    writeln;
  16.    if(dbuse('TEST.DBF') = DBOK) then { open file, read the header of the database file }
  17.       begin
  18.       showstruc;           { show us what you have found }
  19.       if(dbtop = DBOK) then
  20.          writeln('Record 1 field ALPHA = ',dbstr(dbfldno('ALPHA')))
  21.       else
  22.          writeln('Could not find record 1');
  23.       if(dbgoto(2) = DBOK) then
  24.          begin
  25.          writeln('Record 2 field ALPHA   = ',dbstr(dbfldno('ALPHA')));
  26.          writeln('Record 2 field REAL    = ',dbreal(dbfldno('REAL')):8:2);
  27.          writeln('Record 2 field BOOLEAN = ',dblogic(dbfldno('BOOLEAN')));
  28.          end
  29.       else
  30.          writeln('dbgoto returned error, Could not find record 2');
  31.       if(dbgoto(1) = DBOK) then
  32.          begin
  33.          writeln('Record 1 field INTEGER = ',dbint(dbfldno('INTEGER')));
  34.          writeln('Record 1 field BOOLEAN = ',dblogic(dbfldno('BOOLEAN')));
  35.       end
  36.       else
  37.          writeln('Could not find record 1');
  38.  
  39.       if(dbclose <> DBOK) then
  40.          writeln('Error closing DBF file.');
  41.    end
  42.    else
  43.       writeln('Unable to open Dbase file TEST.DBF');
  44.    writeln('End of DBlook.');
  45. end.
  46.